﻿using System;
using System.Collections.Generic;
using System.Text;

namespace NBusiness.Data.Rules
{
    [Serializable]
    public class AuthorizationRule : IAuthorizationRule
    {
        private Type _type;
        private bool _allow = true;
        private string _role;
        private AuthorizationRuleType _ruleType = AuthorizationRuleType.Insert;

        public Type Type
        {
            get { return _type; }
            set { _type = value; }
        }

        public bool Allow
        {
            get { return _allow; }
            set { _allow = value; }
        }
        
        public string Role
        {
            get { return _role; }
            set { _role = value; }
        }
        
        public AuthorizationRuleType RuleType
        {
            get { return _ruleType; }
            set { _ruleType = value; }
        }

        public AuthorizationRule()
        { }

        public AuthorizationRule(Type type, AuthorizationRuleType ruleType, string role)
            : this(type, ruleType, role, true)
        { }

        public AuthorizationRule(Type type, AuthorizationRuleType ruleType, string role, bool allow)
        {
            _type = type;
            _ruleType = ruleType;
            _role = role;
            _allow = allow;
        }
    }
}
